package com.luo.chengrui.module.sa.dal.mysql.datapermission;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import com.luo.chengrui.module.sa.dal.dataobject.datapermission.DataPermissionItemSubDO;
import org.apache.ibatis.annotations.Mapper;
import com.luo.chengrui.module.sa.controller.admin.datapermission.vo.*;

/**
 * 数据权限项明细，代码中用来配置SaDataPermission注解中变量permissionCode的取值。 Mapper
 *
 * @author 诚睿
 */
@Mapper
public interface DataPermissionItemSubMapper extends BaseMapperX<DataPermissionItemSubDO> {

    default PageResult<DataPermissionItemSubDO> selectPage(DataPermissionItemSubPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DataPermissionItemSubDO>()
                .eqIfPresent(DataPermissionItemSubDO::getPermissionItemId, reqVO.getPermissionItemId())
                .eqIfPresent(DataPermissionItemSubDO::getCode, reqVO.getCode())
                .likeIfPresent(DataPermissionItemSubDO::getName, reqVO.getName())
                .eqIfPresent(DataPermissionItemSubDO::getRemark, reqVO.getRemark())
                .eqIfPresent(DataPermissionItemSubDO::getStatus, reqVO.getStatus())
                .eqIfPresent(DataPermissionItemSubDO::getVersion, reqVO.getVersion())
                .orderByDesc(DataPermissionItemSubDO::getId));
    }

    default List<DataPermissionItemSubDO> selectList(DataPermissionItemSubExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<DataPermissionItemSubDO>()
                .eqIfPresent(DataPermissionItemSubDO::getPermissionItemId, reqVO.getPermissionItemId())
                .eqIfPresent(DataPermissionItemSubDO::getCode, reqVO.getCode())
                .likeIfPresent(DataPermissionItemSubDO::getName, reqVO.getName())
                .eqIfPresent(DataPermissionItemSubDO::getRemark, reqVO.getRemark())
                .eqIfPresent(DataPermissionItemSubDO::getStatus, reqVO.getStatus())
                .eqIfPresent(DataPermissionItemSubDO::getVersion, reqVO.getVersion())
                .orderByDesc(DataPermissionItemSubDO::getId));
    }

}
